//Page Object
// 0 引入用来发送请求的 方法
import { request } from "../../request/index.js"

Page({
  data: {
    //轮播图数据
    swiperList:[],
    //导航数组
    catesList:[],
    //楼层数据
    floorList:[]
  },
  //options(Object)
  onLoad: function(options){
    //发送异步请求
    // var reqTask = wx.request({
    //   url: 'https://api-hmugo-web.itheima.net/api/public/v1/home/swiperdata',
    //   success: (result)=>{
    //    this.setData({
    //      swiperList:result.data.message
    //    })
    //   },
    // });
//  request({ url : "https://api-hmugo-web.itheima.net/api/public/v1/home/swiperdata"})
//   .then(result => {
//     this.setData({
//            swiperList:result.data.message
//          })
//          console.log("进入方法了")
//   })
  this.getSwiperList();
  this.getCateList();
  this.getfloorList();
  },

  //获取轮播图数据
  getSwiperList(){
    request({ url : "/home/swiperdata"})
    .then(result => {
      this.setData({
             swiperList:result
           })
           console.log("进入方法了")
    })
  },
 //获取分类导航数据数据
 getCateList(){
  request({ url : "/home/catitems"})
  .then(result => {
    this.setData({
      catesList:result
         })
         console.log("进入方法了")
  })
},
//获取楼层数据
getfloorList(){
  request({ url : "/home/floordata"})
  .then(result => {
    this.setData({
      floorList:result
         })
         console.log("进入方法了1")
  })
},
  onReady: function(){
    
  },
  onShow: function(){
    
  },
  onHide: function(){

  },
  onUnload: function(){

  },
  onPullDownRefresh: function(){

  },
  onReachBottom: function(){

  },
  onShareAppMessage: function(){

  },
  onPageScroll: function(){

  },
  //item(index,pagePath,text)
  onTabItemTap:function(item){

  }
});